using System;
using System.Collections;
using System.Data;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using C1.Win.C1Input;
using C1.Win.C1Preview;
using C1.C1Report;
using PCSComProcurement.Purchase.BO;
using PCSComProcurement.Purchase.DS;
using PCSComUtils.Common;
using PCSComUtils.Common.BO;
using PCSComUtils.MasterSetup.DS;
using PCSComUtils.PCSExc;
using PCSUtils.Log;
using PCSUtils.Utils;
using PCSUtils.Framework.ReportFrame;
using PCSComUtils.DataContext;
using PCSComUtils.MasterSetup.BO;

namespace PCSProcurement.Purchase
{
	/// <summary>
	/// Summary description for PODeliverySlip.
	/// </summary>
	public class PODeliverySlip : System.Windows.Forms.Form
	{
		#region controls

		private C1PrintPreviewControl ppvSlip;
		private Panel pnlControls;
		private Button btnClose;
		private Button btnHelp;
		private Button btnView;
		private C1DateEdit dtmToDateTime;
		private C1DateEdit dtmFromDateTime;
		private Label lblToDateTime;
		private Label lblFromDateTime;
		private RadioButton radPeriod;
		private RadioButton radAll;
		private ToolBarButton c1pBtnClose;

		#endregion

		private const string THIS = "PCSProcurement.Purchase.PODeliverySlip";
		private C1.C1Report.C1Report rptDeliverySlip;
		private C1.C1Report.C1Report rptOverDeliverySlip;
		private C1.C1Report.C1Report rptPrintable;
		private C1.C1Report.C1Report rptOverPrintable;
		private C1.C1Report.C1Report rptPrintableReceive;

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		private PO_PurchaseOrderMasterVO voPOMaster;
		private string strReportFilePath = null;
		private string strPrintFilePath = null;
//		private int intWidth;
//		private int intHeight;
		private const string RECEIVE_SLIP = "ReceiveSlip";
		//private const string DELIVERY_SLIP = "DeliverySlip";
		private const string mstrReportFileName = "DeliverySlip.xml";
		private const string mstrViewFileName = "DeliverySlipView.xml";
		private const string SCHEDULE_HOUR_FLD = "ScheduleHour";
		private const string SHORT_TIME_FORMAT = "HH:mm";
		private const string COMPANY_FLD = "fldCompany";
		private const string ADDRESS_FLD = "fldAddress";
		private const string TEL_FLD = "fldTel";
		private const string FAX_FLD = "fldFax";
		private const string SLIP_NO_FLD = "fldSlipNo";
		private const string SEPERATOR = "-";
		private const string DATE_FORMAT = "yyyyMMddHH";
		private const string PONO_FLD = "fldPoNo";
		private const string ISSUE_DATE_FLD = "fldIssueDate";
		private const string ISSUEHOUR_FLD = "fldIssueHour";
		private const string CUST_CODE_FLD = "fldCustCode";
		private const string CUST_NAME_FLD = "fldCustName";
		private const string CCN_CODE_FLD = "fldCCNCode";
		private const string CCN_NAME_FLD = "fldCCNName";
		private const string SUB_REPORT_FLD = "subReceiveSlip";
		private const string TITLE_FLD = "fldTitle";
		private const string COPIED_FLD = "fldCopied";
		private const string TITLE_VN_FLD = "fldTitleVN";
		private const int MAX_LINE_PER_SLIP = 10;
		private const string TABLE_NAME = "Delivery Slip";
		
		public PODeliverySlip(object pobjPOMaster)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			voPOMaster = (PO_PurchaseOrderMasterVO)pobjPOMaster;
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PODeliverySlip));
			this.ppvSlip = new C1.Win.C1Preview.C1PrintPreviewControl();
			this.c1pBtnClose = new System.Windows.Forms.ToolBarButton();
			this.pnlControls = new System.Windows.Forms.Panel();
			this.btnClose = new System.Windows.Forms.Button();
			this.btnHelp = new System.Windows.Forms.Button();
			this.btnView = new System.Windows.Forms.Button();
			this.dtmToDateTime = new C1.Win.C1Input.C1DateEdit();
			this.dtmFromDateTime = new C1.Win.C1Input.C1DateEdit();
			this.lblToDateTime = new System.Windows.Forms.Label();
			this.lblFromDateTime = new System.Windows.Forms.Label();
			this.radPeriod = new System.Windows.Forms.RadioButton();
			this.radAll = new System.Windows.Forms.RadioButton();
			this.rptDeliverySlip = new C1.C1Report.C1Report();
			this.rptPrintable = new C1.C1Report.C1Report();
			this.rptPrintableReceive = new C1.C1Report.C1Report();
			((System.ComponentModel.ISupportInitialize)(this.ppvSlip)).BeginInit();
			this.pnlControls.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dtmToDateTime)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dtmFromDateTime)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.rptDeliverySlip)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.rptPrintable)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.rptPrintableReceive)).BeginInit();
			this.SuspendLayout();
			// 
			// ppvSlip
			// 
			this.ppvSlip.AccessibleDescription = resources.GetString("ppvSlip.AccessibleDescription");
			this.ppvSlip.AccessibleName = resources.GetString("ppvSlip.AccessibleName");
			this.ppvSlip.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("ppvSlip.Anchor")));
			this.ppvSlip.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("ppvSlip.BackgroundImage")));
			this.ppvSlip.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("ppvSlip.Dock")));
			this.ppvSlip.Enabled = ((bool)(resources.GetObject("ppvSlip.Enabled")));
			this.ppvSlip.Font = ((System.Drawing.Font)(resources.GetObject("ppvSlip.Font")));
			this.ppvSlip.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("ppvSlip.ImeMode")));
			this.ppvSlip.Location = ((System.Drawing.Point)(resources.GetObject("ppvSlip.Location")));
			this.ppvSlip.Name = "ppvSlip";
			this.ppvSlip.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
			this.ppvSlip.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("ppvSlip.RightToLeft")));
			this.ppvSlip.Size = ((System.Drawing.Size)(resources.GetObject("ppvSlip.Size")));
			this.ppvSlip.TabIndex = ((int)(resources.GetObject("ppvSlip.TabIndex")));
			this.ppvSlip.Visible = ((bool)(resources.GetObject("ppvSlip.Visible")));
			// 
			// c1pBtnClose
			// 
			this.c1pBtnClose.Enabled = ((bool)(resources.GetObject("c1pBtnClose.Enabled")));
			this.c1pBtnClose.ImageIndex = ((int)(resources.GetObject("c1pBtnClose.ImageIndex")));
			this.c1pBtnClose.Text = resources.GetString("c1pBtnClose.Text");
			this.c1pBtnClose.ToolTipText = resources.GetString("c1pBtnClose.ToolTipText");
			this.c1pBtnClose.Visible = ((bool)(resources.GetObject("c1pBtnClose.Visible")));
			// 
			// pnlControls
			// 
			this.pnlControls.AccessibleDescription = resources.GetString("pnlControls.AccessibleDescription");
			this.pnlControls.AccessibleName = resources.GetString("pnlControls.AccessibleName");
			this.pnlControls.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("pnlControls.Anchor")));
			this.pnlControls.AutoScroll = ((bool)(resources.GetObject("pnlControls.AutoScroll")));
			this.pnlControls.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("pnlControls.AutoScrollMargin")));
			this.pnlControls.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("pnlControls.AutoScrollMinSize")));
			this.pnlControls.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pnlControls.BackgroundImage")));
			this.pnlControls.Controls.Add(this.btnClose);
			this.pnlControls.Controls.Add(this.btnHelp);
			this.pnlControls.Controls.Add(this.btnView);
			this.pnlControls.Controls.Add(this.dtmToDateTime);
			this.pnlControls.Controls.Add(this.dtmFromDateTime);
			this.pnlControls.Controls.Add(this.lblToDateTime);
			this.pnlControls.Controls.Add(this.lblFromDateTime);
			this.pnlControls.Controls.Add(this.radPeriod);
			this.pnlControls.Controls.Add(this.radAll);
			this.pnlControls.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("pnlControls.Dock")));
			this.pnlControls.Enabled = ((bool)(resources.GetObject("pnlControls.Enabled")));
			this.pnlControls.Font = ((System.Drawing.Font)(resources.GetObject("pnlControls.Font")));
			this.pnlControls.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("pnlControls.ImeMode")));
			this.pnlControls.Location = ((System.Drawing.Point)(resources.GetObject("pnlControls.Location")));
			this.pnlControls.Name = "pnlControls";
			this.pnlControls.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("pnlControls.RightToLeft")));
			this.pnlControls.Size = ((System.Drawing.Size)(resources.GetObject("pnlControls.Size")));
			this.pnlControls.TabIndex = ((int)(resources.GetObject("pnlControls.TabIndex")));
			this.pnlControls.Text = resources.GetString("pnlControls.Text");
			this.pnlControls.Visible = ((bool)(resources.GetObject("pnlControls.Visible")));
			// 
			// btnClose
			// 
			this.btnClose.AccessibleDescription = resources.GetString("btnClose.AccessibleDescription");
			this.btnClose.AccessibleName = resources.GetString("btnClose.AccessibleName");
			this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnClose.Anchor")));
			this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
			this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnClose.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnClose.Dock")));
			this.btnClose.Enabled = ((bool)(resources.GetObject("btnClose.Enabled")));
			this.btnClose.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnClose.FlatStyle")));
			this.btnClose.Font = ((System.Drawing.Font)(resources.GetObject("btnClose.Font")));
			this.btnClose.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
			this.btnClose.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.ImageAlign")));
			this.btnClose.ImageIndex = ((int)(resources.GetObject("btnClose.ImageIndex")));
			this.btnClose.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnClose.ImeMode")));
			this.btnClose.Location = ((System.Drawing.Point)(resources.GetObject("btnClose.Location")));
			this.btnClose.Name = "btnClose";
			this.btnClose.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnClose.RightToLeft")));
			this.btnClose.Size = ((System.Drawing.Size)(resources.GetObject("btnClose.Size")));
			this.btnClose.TabIndex = ((int)(resources.GetObject("btnClose.TabIndex")));
			this.btnClose.Text = resources.GetString("btnClose.Text");
			this.btnClose.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnClose.TextAlign")));
			this.btnClose.Visible = ((bool)(resources.GetObject("btnClose.Visible")));
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnHelp
			// 
			this.btnHelp.AccessibleDescription = resources.GetString("btnHelp.AccessibleDescription");
			this.btnHelp.AccessibleName = resources.GetString("btnHelp.AccessibleName");
			this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnHelp.Anchor")));
			this.btnHelp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnHelp.BackgroundImage")));
			this.btnHelp.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnHelp.Dock")));
			this.btnHelp.Enabled = ((bool)(resources.GetObject("btnHelp.Enabled")));
			this.btnHelp.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnHelp.FlatStyle")));
			this.btnHelp.Font = ((System.Drawing.Font)(resources.GetObject("btnHelp.Font")));
			this.btnHelp.Image = ((System.Drawing.Image)(resources.GetObject("btnHelp.Image")));
			this.btnHelp.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.ImageAlign")));
			this.btnHelp.ImageIndex = ((int)(resources.GetObject("btnHelp.ImageIndex")));
			this.btnHelp.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnHelp.ImeMode")));
			this.btnHelp.Location = ((System.Drawing.Point)(resources.GetObject("btnHelp.Location")));
			this.btnHelp.Name = "btnHelp";
			this.btnHelp.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnHelp.RightToLeft")));
			this.btnHelp.Size = ((System.Drawing.Size)(resources.GetObject("btnHelp.Size")));
			this.btnHelp.TabIndex = ((int)(resources.GetObject("btnHelp.TabIndex")));
			this.btnHelp.Text = resources.GetString("btnHelp.Text");
			this.btnHelp.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnHelp.TextAlign")));
			this.btnHelp.Visible = ((bool)(resources.GetObject("btnHelp.Visible")));
			this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
			// 
			// btnView
			// 
			this.btnView.AccessibleDescription = resources.GetString("btnView.AccessibleDescription");
			this.btnView.AccessibleName = resources.GetString("btnView.AccessibleName");
			this.btnView.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("btnView.Anchor")));
			this.btnView.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnView.BackgroundImage")));
			this.btnView.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("btnView.Dock")));
			this.btnView.Enabled = ((bool)(resources.GetObject("btnView.Enabled")));
			this.btnView.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("btnView.FlatStyle")));
			this.btnView.Font = ((System.Drawing.Font)(resources.GetObject("btnView.Font")));
			this.btnView.Image = ((System.Drawing.Image)(resources.GetObject("btnView.Image")));
			this.btnView.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnView.ImageAlign")));
			this.btnView.ImageIndex = ((int)(resources.GetObject("btnView.ImageIndex")));
			this.btnView.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("btnView.ImeMode")));
			this.btnView.Location = ((System.Drawing.Point)(resources.GetObject("btnView.Location")));
			this.btnView.Name = "btnView";
			this.btnView.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("btnView.RightToLeft")));
			this.btnView.Size = ((System.Drawing.Size)(resources.GetObject("btnView.Size")));
			this.btnView.TabIndex = ((int)(resources.GetObject("btnView.TabIndex")));
			this.btnView.Text = resources.GetString("btnView.Text");
			this.btnView.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("btnView.TextAlign")));
			this.btnView.Visible = ((bool)(resources.GetObject("btnView.Visible")));
			this.btnView.Click += new System.EventHandler(this.btnView_Click);
			// 
			// dtmToDateTime
			// 
			this.dtmToDateTime.AcceptsEscape = ((bool)(resources.GetObject("dtmToDateTime.AcceptsEscape")));
			this.dtmToDateTime.AccessibleDescription = resources.GetString("dtmToDateTime.AccessibleDescription");
			this.dtmToDateTime.AccessibleName = resources.GetString("dtmToDateTime.AccessibleName");
			this.dtmToDateTime.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dtmToDateTime.Anchor")));
			this.dtmToDateTime.AutoSize = ((bool)(resources.GetObject("dtmToDateTime.AutoSize")));
			this.dtmToDateTime.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmToDateTime.BackgroundImage")));
			this.dtmToDateTime.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dtmToDateTime.BorderStyle")));
			// 
			// dtmToDateTime.Calendar
			// 
			this.dtmToDateTime.Calendar.AccessibleDescription = resources.GetString("dtmToDateTime.Calendar.AccessibleDescription");
			this.dtmToDateTime.Calendar.AccessibleName = resources.GetString("dtmToDateTime.Calendar.AccessibleName");
			this.dtmToDateTime.Calendar.AnnuallyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmToDateTime.Calendar.AnnuallyBoldedDates")));
			this.dtmToDateTime.Calendar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmToDateTime.Calendar.BackgroundImage")));
			this.dtmToDateTime.Calendar.BoldedDates = ((System.DateTime[])(resources.GetObject("dtmToDateTime.Calendar.BoldedDates")));
			this.dtmToDateTime.Calendar.CalendarDimensions = ((System.Drawing.Size)(resources.GetObject("dtmToDateTime.Calendar.CalendarDimensions")));
			this.dtmToDateTime.Calendar.Enabled = ((bool)(resources.GetObject("dtmToDateTime.Calendar.Enabled")));
			this.dtmToDateTime.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmToDateTime.Calendar.FirstDayOfWeek")));
			this.dtmToDateTime.Calendar.Font = ((System.Drawing.Font)(resources.GetObject("dtmToDateTime.Calendar.Font")));
			this.dtmToDateTime.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmToDateTime.Calendar.ImeMode")));
			this.dtmToDateTime.Calendar.MonthlyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmToDateTime.Calendar.MonthlyBoldedDates")));
			this.dtmToDateTime.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmToDateTime.Calendar.RightToLeft")));
			this.dtmToDateTime.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmToDateTime.Calendar.ShowClearButton")));
			this.dtmToDateTime.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmToDateTime.Calendar.ShowTodayButton")));
			this.dtmToDateTime.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmToDateTime.Calendar.ShowWeekNumbers")));
			this.dtmToDateTime.CaseSensitive = ((bool)(resources.GetObject("dtmToDateTime.CaseSensitive")));
			this.dtmToDateTime.Culture = ((int)(resources.GetObject("dtmToDateTime.Culture")));
			this.dtmToDateTime.CurrentTimeZone = ((bool)(resources.GetObject("dtmToDateTime.CurrentTimeZone")));
			this.dtmToDateTime.CustomFormat = resources.GetString("dtmToDateTime.CustomFormat");
			this.dtmToDateTime.DaylightTimeAdjustment = ((C1.Win.C1Input.DaylightTimeAdjustmentEnum)(resources.GetObject("dtmToDateTime.DaylightTimeAdjustment")));
			this.dtmToDateTime.DisplayFormat.CustomFormat = resources.GetString("dtmToDateTime.DisplayFormat.CustomFormat");
			this.dtmToDateTime.DisplayFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmToDateTime.DisplayFormat.FormatType")));
			this.dtmToDateTime.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmToDateTime.DisplayFormat.Inherit")));
			this.dtmToDateTime.DisplayFormat.NullText = resources.GetString("dtmToDateTime.DisplayFormat.NullText");
			this.dtmToDateTime.DisplayFormat.TrimEnd = ((bool)(resources.GetObject("dtmToDateTime.DisplayFormat.TrimEnd")));
			this.dtmToDateTime.DisplayFormat.TrimStart = ((bool)(resources.GetObject("dtmToDateTime.DisplayFormat.TrimStart")));
			this.dtmToDateTime.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dtmToDateTime.Dock")));
			this.dtmToDateTime.DropDownFormAlign = ((C1.Win.C1Input.DropDownFormAlignmentEnum)(resources.GetObject("dtmToDateTime.DropDownFormAlign")));
			this.dtmToDateTime.EditFormat.CustomFormat = resources.GetString("dtmToDateTime.EditFormat.CustomFormat");
			this.dtmToDateTime.EditFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmToDateTime.EditFormat.FormatType")));
			this.dtmToDateTime.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmToDateTime.EditFormat.Inherit")));
			this.dtmToDateTime.EditFormat.NullText = resources.GetString("dtmToDateTime.EditFormat.NullText");
			this.dtmToDateTime.EditFormat.TrimEnd = ((bool)(resources.GetObject("dtmToDateTime.EditFormat.TrimEnd")));
			this.dtmToDateTime.EditFormat.TrimStart = ((bool)(resources.GetObject("dtmToDateTime.EditFormat.TrimStart")));
			this.dtmToDateTime.EditMask = resources.GetString("dtmToDateTime.EditMask");
			this.dtmToDateTime.EmptyAsNull = ((bool)(resources.GetObject("dtmToDateTime.EmptyAsNull")));
			this.dtmToDateTime.Enabled = ((bool)(resources.GetObject("dtmToDateTime.Enabled")));
			this.dtmToDateTime.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmToDateTime.ErrorInfo.BeepOnError")));
			this.dtmToDateTime.ErrorInfo.ErrorMessage = resources.GetString("dtmToDateTime.ErrorInfo.ErrorMessage");
			this.dtmToDateTime.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmToDateTime.ErrorInfo.ErrorMessageCaption");
			this.dtmToDateTime.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmToDateTime.ErrorInfo.ShowErrorMessage")));
			this.dtmToDateTime.ErrorInfo.ValueOnError = ((object)(resources.GetObject("dtmToDateTime.ErrorInfo.ValueOnError")));
			this.dtmToDateTime.Font = ((System.Drawing.Font)(resources.GetObject("dtmToDateTime.Font")));
			this.dtmToDateTime.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmToDateTime.FormatType")));
			this.dtmToDateTime.GapHeight = ((int)(resources.GetObject("dtmToDateTime.GapHeight")));
			this.dtmToDateTime.GMTOffset = ((System.TimeSpan)(resources.GetObject("dtmToDateTime.GMTOffset")));
			this.dtmToDateTime.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmToDateTime.ImeMode")));
			this.dtmToDateTime.InitialSelection = ((C1.Win.C1Input.InitialSelectionEnum)(resources.GetObject("dtmToDateTime.InitialSelection")));
			this.dtmToDateTime.Location = ((System.Drawing.Point)(resources.GetObject("dtmToDateTime.Location")));
			this.dtmToDateTime.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmToDateTime.MaskInfo.AutoTabWhenFilled")));
			this.dtmToDateTime.MaskInfo.CaseSensitive = ((bool)(resources.GetObject("dtmToDateTime.MaskInfo.CaseSensitive")));
			this.dtmToDateTime.MaskInfo.CopyWithLiterals = ((bool)(resources.GetObject("dtmToDateTime.MaskInfo.CopyWithLiterals")));
			this.dtmToDateTime.MaskInfo.EditMask = resources.GetString("dtmToDateTime.MaskInfo.EditMask");
			this.dtmToDateTime.MaskInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmToDateTime.MaskInfo.EmptyAsNull")));
			this.dtmToDateTime.MaskInfo.ErrorMessage = resources.GetString("dtmToDateTime.MaskInfo.ErrorMessage");
			this.dtmToDateTime.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmToDateTime.MaskInfo.Inherit")));
			this.dtmToDateTime.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmToDateTime.MaskInfo.PromptChar")));
			this.dtmToDateTime.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmToDateTime.MaskInfo.ShowLiterals")));
			this.dtmToDateTime.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmToDateTime.MaskInfo.StoredEmptyChar")));
			this.dtmToDateTime.MaxLength = ((int)(resources.GetObject("dtmToDateTime.MaxLength")));
			this.dtmToDateTime.Name = "dtmToDateTime";
			this.dtmToDateTime.NullText = resources.GetString("dtmToDateTime.NullText");
			this.dtmToDateTime.ParseInfo.CaseSensitive = ((bool)(resources.GetObject("dtmToDateTime.ParseInfo.CaseSensitive")));
			this.dtmToDateTime.ParseInfo.CustomFormat = resources.GetString("dtmToDateTime.ParseInfo.CustomFormat");
			this.dtmToDateTime.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmToDateTime.ParseInfo.DateTimeStyle")));
			this.dtmToDateTime.ParseInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmToDateTime.ParseInfo.EmptyAsNull")));
			this.dtmToDateTime.ParseInfo.ErrorMessage = resources.GetString("dtmToDateTime.ParseInfo.ErrorMessage");
			this.dtmToDateTime.ParseInfo.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmToDateTime.ParseInfo.FormatType")));
			this.dtmToDateTime.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmToDateTime.ParseInfo.Inherit")));
			this.dtmToDateTime.ParseInfo.NullText = resources.GetString("dtmToDateTime.ParseInfo.NullText");
			this.dtmToDateTime.ParseInfo.TrimEnd = ((bool)(resources.GetObject("dtmToDateTime.ParseInfo.TrimEnd")));
			this.dtmToDateTime.ParseInfo.TrimStart = ((bool)(resources.GetObject("dtmToDateTime.ParseInfo.TrimStart")));
			this.dtmToDateTime.PasswordChar = ((char)(resources.GetObject("dtmToDateTime.PasswordChar")));
			this.dtmToDateTime.PostValidation.CaseSensitive = ((bool)(resources.GetObject("dtmToDateTime.PostValidation.CaseSensitive")));
			this.dtmToDateTime.PostValidation.ErrorMessage = resources.GetString("dtmToDateTime.PostValidation.ErrorMessage");
			this.dtmToDateTime.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmToDateTime.PostValidation.Inherit")));
			this.dtmToDateTime.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmToDateTime.PostValidation.Validation")));
			this.dtmToDateTime.PostValidation.Values = ((System.Array)(resources.GetObject("dtmToDateTime.PostValidation.Values")));
			this.dtmToDateTime.PostValidation.ValuesExcluded = ((System.Array)(resources.GetObject("dtmToDateTime.PostValidation.ValuesExcluded")));
			this.dtmToDateTime.PreValidation.CaseSensitive = ((bool)(resources.GetObject("dtmToDateTime.PreValidation.CaseSensitive")));
			this.dtmToDateTime.PreValidation.ErrorMessage = resources.GetString("dtmToDateTime.PreValidation.ErrorMessage");
			this.dtmToDateTime.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmToDateTime.PreValidation.Inherit")));
			this.dtmToDateTime.PreValidation.ItemSeparator = resources.GetString("dtmToDateTime.PreValidation.ItemSeparator");
			this.dtmToDateTime.PreValidation.PatternString = resources.GetString("dtmToDateTime.PreValidation.PatternString");
			this.dtmToDateTime.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmToDateTime.PreValidation.RegexOptions")));
			this.dtmToDateTime.PreValidation.TrimEnd = ((bool)(resources.GetObject("dtmToDateTime.PreValidation.TrimEnd")));
			this.dtmToDateTime.PreValidation.TrimStart = ((bool)(resources.GetObject("dtmToDateTime.PreValidation.TrimStart")));
			this.dtmToDateTime.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmToDateTime.PreValidation.Validation")));
			this.dtmToDateTime.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmToDateTime.RightToLeft")));
			this.dtmToDateTime.ShowFocusRectangle = ((bool)(resources.GetObject("dtmToDateTime.ShowFocusRectangle")));
			this.dtmToDateTime.Size = ((System.Drawing.Size)(resources.GetObject("dtmToDateTime.Size")));
			this.dtmToDateTime.TabIndex = ((int)(resources.GetObject("dtmToDateTime.TabIndex")));
			this.dtmToDateTime.Tag = ((object)(resources.GetObject("dtmToDateTime.Tag")));
			this.dtmToDateTime.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("dtmToDateTime.TextAlign")));
			this.dtmToDateTime.TrimEnd = ((bool)(resources.GetObject("dtmToDateTime.TrimEnd")));
			this.dtmToDateTime.TrimStart = ((bool)(resources.GetObject("dtmToDateTime.TrimStart")));
			this.dtmToDateTime.UserCultureOverride = ((bool)(resources.GetObject("dtmToDateTime.UserCultureOverride")));
			this.dtmToDateTime.Value = ((object)(resources.GetObject("dtmToDateTime.Value")));
			this.dtmToDateTime.VerticalAlign = ((C1.Win.C1Input.VerticalAlignEnum)(resources.GetObject("dtmToDateTime.VerticalAlign")));
			this.dtmToDateTime.Visible = ((bool)(resources.GetObject("dtmToDateTime.Visible")));
			this.dtmToDateTime.VisibleButtons = ((C1.Win.C1Input.DropDownControlButtonFlags)(resources.GetObject("dtmToDateTime.VisibleButtons")));
			// 
			// dtmFromDateTime
			// 
			this.dtmFromDateTime.AcceptsEscape = ((bool)(resources.GetObject("dtmFromDateTime.AcceptsEscape")));
			this.dtmFromDateTime.AccessibleDescription = resources.GetString("dtmFromDateTime.AccessibleDescription");
			this.dtmFromDateTime.AccessibleName = resources.GetString("dtmFromDateTime.AccessibleName");
			this.dtmFromDateTime.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("dtmFromDateTime.Anchor")));
			this.dtmFromDateTime.AutoSize = ((bool)(resources.GetObject("dtmFromDateTime.AutoSize")));
			this.dtmFromDateTime.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmFromDateTime.BackgroundImage")));
			this.dtmFromDateTime.BorderStyle = ((System.Windows.Forms.BorderStyle)(resources.GetObject("dtmFromDateTime.BorderStyle")));
			// 
			// dtmFromDateTime.Calendar
			// 
			this.dtmFromDateTime.Calendar.AccessibleDescription = resources.GetString("dtmFromDateTime.Calendar.AccessibleDescription");
			this.dtmFromDateTime.Calendar.AccessibleName = resources.GetString("dtmFromDateTime.Calendar.AccessibleName");
			this.dtmFromDateTime.Calendar.AnnuallyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmFromDateTime.Calendar.AnnuallyBoldedDates")));
			this.dtmFromDateTime.Calendar.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("dtmFromDateTime.Calendar.BackgroundImage")));
			this.dtmFromDateTime.Calendar.BoldedDates = ((System.DateTime[])(resources.GetObject("dtmFromDateTime.Calendar.BoldedDates")));
			this.dtmFromDateTime.Calendar.CalendarDimensions = ((System.Drawing.Size)(resources.GetObject("dtmFromDateTime.Calendar.CalendarDimensions")));
			this.dtmFromDateTime.Calendar.Enabled = ((bool)(resources.GetObject("dtmFromDateTime.Calendar.Enabled")));
			this.dtmFromDateTime.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmFromDateTime.Calendar.FirstDayOfWeek")));
			this.dtmFromDateTime.Calendar.Font = ((System.Drawing.Font)(resources.GetObject("dtmFromDateTime.Calendar.Font")));
			this.dtmFromDateTime.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmFromDateTime.Calendar.ImeMode")));
			this.dtmFromDateTime.Calendar.MonthlyBoldedDates = ((System.DateTime[])(resources.GetObject("dtmFromDateTime.Calendar.MonthlyBoldedDates")));
			this.dtmFromDateTime.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmFromDateTime.Calendar.RightToLeft")));
			this.dtmFromDateTime.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmFromDateTime.Calendar.ShowClearButton")));
			this.dtmFromDateTime.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmFromDateTime.Calendar.ShowTodayButton")));
			this.dtmFromDateTime.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmFromDateTime.Calendar.ShowWeekNumbers")));
			this.dtmFromDateTime.CaseSensitive = ((bool)(resources.GetObject("dtmFromDateTime.CaseSensitive")));
			this.dtmFromDateTime.Culture = ((int)(resources.GetObject("dtmFromDateTime.Culture")));
			this.dtmFromDateTime.CurrentTimeZone = ((bool)(resources.GetObject("dtmFromDateTime.CurrentTimeZone")));
			this.dtmFromDateTime.CustomFormat = resources.GetString("dtmFromDateTime.CustomFormat");
			this.dtmFromDateTime.DaylightTimeAdjustment = ((C1.Win.C1Input.DaylightTimeAdjustmentEnum)(resources.GetObject("dtmFromDateTime.DaylightTimeAdjustment")));
			this.dtmFromDateTime.DisplayFormat.CustomFormat = resources.GetString("dtmFromDateTime.DisplayFormat.CustomFormat");
			this.dtmFromDateTime.DisplayFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmFromDateTime.DisplayFormat.FormatType")));
			this.dtmFromDateTime.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmFromDateTime.DisplayFormat.Inherit")));
			this.dtmFromDateTime.DisplayFormat.NullText = resources.GetString("dtmFromDateTime.DisplayFormat.NullText");
			this.dtmFromDateTime.DisplayFormat.TrimEnd = ((bool)(resources.GetObject("dtmFromDateTime.DisplayFormat.TrimEnd")));
			this.dtmFromDateTime.DisplayFormat.TrimStart = ((bool)(resources.GetObject("dtmFromDateTime.DisplayFormat.TrimStart")));
			this.dtmFromDateTime.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("dtmFromDateTime.Dock")));
			this.dtmFromDateTime.DropDownFormAlign = ((C1.Win.C1Input.DropDownFormAlignmentEnum)(resources.GetObject("dtmFromDateTime.DropDownFormAlign")));
			this.dtmFromDateTime.EditFormat.CustomFormat = resources.GetString("dtmFromDateTime.EditFormat.CustomFormat");
			this.dtmFromDateTime.EditFormat.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmFromDateTime.EditFormat.FormatType")));
			this.dtmFromDateTime.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmFromDateTime.EditFormat.Inherit")));
			this.dtmFromDateTime.EditFormat.NullText = resources.GetString("dtmFromDateTime.EditFormat.NullText");
			this.dtmFromDateTime.EditFormat.TrimEnd = ((bool)(resources.GetObject("dtmFromDateTime.EditFormat.TrimEnd")));
			this.dtmFromDateTime.EditFormat.TrimStart = ((bool)(resources.GetObject("dtmFromDateTime.EditFormat.TrimStart")));
			this.dtmFromDateTime.EditMask = resources.GetString("dtmFromDateTime.EditMask");
			this.dtmFromDateTime.EmptyAsNull = ((bool)(resources.GetObject("dtmFromDateTime.EmptyAsNull")));
			this.dtmFromDateTime.Enabled = ((bool)(resources.GetObject("dtmFromDateTime.Enabled")));
			this.dtmFromDateTime.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmFromDateTime.ErrorInfo.BeepOnError")));
			this.dtmFromDateTime.ErrorInfo.ErrorMessage = resources.GetString("dtmFromDateTime.ErrorInfo.ErrorMessage");
			this.dtmFromDateTime.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmFromDateTime.ErrorInfo.ErrorMessageCaption");
			this.dtmFromDateTime.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmFromDateTime.ErrorInfo.ShowErrorMessage")));
			this.dtmFromDateTime.ErrorInfo.ValueOnError = ((object)(resources.GetObject("dtmFromDateTime.ErrorInfo.ValueOnError")));
			this.dtmFromDateTime.Font = ((System.Drawing.Font)(resources.GetObject("dtmFromDateTime.Font")));
			this.dtmFromDateTime.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmFromDateTime.FormatType")));
			this.dtmFromDateTime.GapHeight = ((int)(resources.GetObject("dtmFromDateTime.GapHeight")));
			this.dtmFromDateTime.GMTOffset = ((System.TimeSpan)(resources.GetObject("dtmFromDateTime.GMTOffset")));
			this.dtmFromDateTime.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmFromDateTime.ImeMode")));
			this.dtmFromDateTime.InitialSelection = ((C1.Win.C1Input.InitialSelectionEnum)(resources.GetObject("dtmFromDateTime.InitialSelection")));
			this.dtmFromDateTime.Location = ((System.Drawing.Point)(resources.GetObject("dtmFromDateTime.Location")));
			this.dtmFromDateTime.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmFromDateTime.MaskInfo.AutoTabWhenFilled")));
			this.dtmFromDateTime.MaskInfo.CaseSensitive = ((bool)(resources.GetObject("dtmFromDateTime.MaskInfo.CaseSensitive")));
			this.dtmFromDateTime.MaskInfo.CopyWithLiterals = ((bool)(resources.GetObject("dtmFromDateTime.MaskInfo.CopyWithLiterals")));
			this.dtmFromDateTime.MaskInfo.EditMask = resources.GetString("dtmFromDateTime.MaskInfo.EditMask");
			this.dtmFromDateTime.MaskInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmFromDateTime.MaskInfo.EmptyAsNull")));
			this.dtmFromDateTime.MaskInfo.ErrorMessage = resources.GetString("dtmFromDateTime.MaskInfo.ErrorMessage");
			this.dtmFromDateTime.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmFromDateTime.MaskInfo.Inherit")));
			this.dtmFromDateTime.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmFromDateTime.MaskInfo.PromptChar")));
			this.dtmFromDateTime.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmFromDateTime.MaskInfo.ShowLiterals")));
			this.dtmFromDateTime.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmFromDateTime.MaskInfo.StoredEmptyChar")));
			this.dtmFromDateTime.MaxLength = ((int)(resources.GetObject("dtmFromDateTime.MaxLength")));
			this.dtmFromDateTime.Name = "dtmFromDateTime";
			this.dtmFromDateTime.NullText = resources.GetString("dtmFromDateTime.NullText");
			this.dtmFromDateTime.ParseInfo.CaseSensitive = ((bool)(resources.GetObject("dtmFromDateTime.ParseInfo.CaseSensitive")));
			this.dtmFromDateTime.ParseInfo.CustomFormat = resources.GetString("dtmFromDateTime.ParseInfo.CustomFormat");
			this.dtmFromDateTime.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmFromDateTime.ParseInfo.DateTimeStyle")));
			this.dtmFromDateTime.ParseInfo.EmptyAsNull = ((bool)(resources.GetObject("dtmFromDateTime.ParseInfo.EmptyAsNull")));
			this.dtmFromDateTime.ParseInfo.ErrorMessage = resources.GetString("dtmFromDateTime.ParseInfo.ErrorMessage");
			this.dtmFromDateTime.ParseInfo.FormatType = ((C1.Win.C1Input.FormatTypeEnum)(resources.GetObject("dtmFromDateTime.ParseInfo.FormatType")));
			this.dtmFromDateTime.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmFromDateTime.ParseInfo.Inherit")));
			this.dtmFromDateTime.ParseInfo.NullText = resources.GetString("dtmFromDateTime.ParseInfo.NullText");
			this.dtmFromDateTime.ParseInfo.TrimEnd = ((bool)(resources.GetObject("dtmFromDateTime.ParseInfo.TrimEnd")));
			this.dtmFromDateTime.ParseInfo.TrimStart = ((bool)(resources.GetObject("dtmFromDateTime.ParseInfo.TrimStart")));
			this.dtmFromDateTime.PasswordChar = ((char)(resources.GetObject("dtmFromDateTime.PasswordChar")));
			this.dtmFromDateTime.PostValidation.CaseSensitive = ((bool)(resources.GetObject("dtmFromDateTime.PostValidation.CaseSensitive")));
			this.dtmFromDateTime.PostValidation.ErrorMessage = resources.GetString("dtmFromDateTime.PostValidation.ErrorMessage");
			this.dtmFromDateTime.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmFromDateTime.PostValidation.Inherit")));
			this.dtmFromDateTime.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmFromDateTime.PostValidation.Validation")));
			this.dtmFromDateTime.PostValidation.Values = ((System.Array)(resources.GetObject("dtmFromDateTime.PostValidation.Values")));
			this.dtmFromDateTime.PostValidation.ValuesExcluded = ((System.Array)(resources.GetObject("dtmFromDateTime.PostValidation.ValuesExcluded")));
			this.dtmFromDateTime.PreValidation.CaseSensitive = ((bool)(resources.GetObject("dtmFromDateTime.PreValidation.CaseSensitive")));
			this.dtmFromDateTime.PreValidation.ErrorMessage = resources.GetString("dtmFromDateTime.PreValidation.ErrorMessage");
			this.dtmFromDateTime.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmFromDateTime.PreValidation.Inherit")));
			this.dtmFromDateTime.PreValidation.ItemSeparator = resources.GetString("dtmFromDateTime.PreValidation.ItemSeparator");
			this.dtmFromDateTime.PreValidation.PatternString = resources.GetString("dtmFromDateTime.PreValidation.PatternString");
			this.dtmFromDateTime.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmFromDateTime.PreValidation.RegexOptions")));
			this.dtmFromDateTime.PreValidation.TrimEnd = ((bool)(resources.GetObject("dtmFromDateTime.PreValidation.TrimEnd")));
			this.dtmFromDateTime.PreValidation.TrimStart = ((bool)(resources.GetObject("dtmFromDateTime.PreValidation.TrimStart")));
			this.dtmFromDateTime.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmFromDateTime.PreValidation.Validation")));
			this.dtmFromDateTime.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmFromDateTime.RightToLeft")));
			this.dtmFromDateTime.ShowFocusRectangle = ((bool)(resources.GetObject("dtmFromDateTime.ShowFocusRectangle")));
			this.dtmFromDateTime.Size = ((System.Drawing.Size)(resources.GetObject("dtmFromDateTime.Size")));
			this.dtmFromDateTime.TabIndex = ((int)(resources.GetObject("dtmFromDateTime.TabIndex")));
			this.dtmFromDateTime.Tag = ((object)(resources.GetObject("dtmFromDateTime.Tag")));
			this.dtmFromDateTime.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("dtmFromDateTime.TextAlign")));
			this.dtmFromDateTime.TrimEnd = ((bool)(resources.GetObject("dtmFromDateTime.TrimEnd")));
			this.dtmFromDateTime.TrimStart = ((bool)(resources.GetObject("dtmFromDateTime.TrimStart")));
			this.dtmFromDateTime.UserCultureOverride = ((bool)(resources.GetObject("dtmFromDateTime.UserCultureOverride")));
			this.dtmFromDateTime.Value = ((object)(resources.GetObject("dtmFromDateTime.Value")));
			this.dtmFromDateTime.VerticalAlign = ((C1.Win.C1Input.VerticalAlignEnum)(resources.GetObject("dtmFromDateTime.VerticalAlign")));
			this.dtmFromDateTime.Visible = ((bool)(resources.GetObject("dtmFromDateTime.Visible")));
			this.dtmFromDateTime.VisibleButtons = ((C1.Win.C1Input.DropDownControlButtonFlags)(resources.GetObject("dtmFromDateTime.VisibleButtons")));
			// 
			// lblToDateTime
			// 
			this.lblToDateTime.AccessibleDescription = resources.GetString("lblToDateTime.AccessibleDescription");
			this.lblToDateTime.AccessibleName = resources.GetString("lblToDateTime.AccessibleName");
			this.lblToDateTime.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblToDateTime.Anchor")));
			this.lblToDateTime.AutoSize = ((bool)(resources.GetObject("lblToDateTime.AutoSize")));
			this.lblToDateTime.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblToDateTime.Dock")));
			this.lblToDateTime.Enabled = ((bool)(resources.GetObject("lblToDateTime.Enabled")));
			this.lblToDateTime.Font = ((System.Drawing.Font)(resources.GetObject("lblToDateTime.Font")));
			this.lblToDateTime.ForeColor = System.Drawing.Color.Maroon;
			this.lblToDateTime.Image = ((System.Drawing.Image)(resources.GetObject("lblToDateTime.Image")));
			this.lblToDateTime.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToDateTime.ImageAlign")));
			this.lblToDateTime.ImageIndex = ((int)(resources.GetObject("lblToDateTime.ImageIndex")));
			this.lblToDateTime.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblToDateTime.ImeMode")));
			this.lblToDateTime.Location = ((System.Drawing.Point)(resources.GetObject("lblToDateTime.Location")));
			this.lblToDateTime.Name = "lblToDateTime";
			this.lblToDateTime.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblToDateTime.RightToLeft")));
			this.lblToDateTime.Size = ((System.Drawing.Size)(resources.GetObject("lblToDateTime.Size")));
			this.lblToDateTime.TabIndex = ((int)(resources.GetObject("lblToDateTime.TabIndex")));
			this.lblToDateTime.Text = resources.GetString("lblToDateTime.Text");
			this.lblToDateTime.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblToDateTime.TextAlign")));
			this.lblToDateTime.Visible = ((bool)(resources.GetObject("lblToDateTime.Visible")));
			// 
			// lblFromDateTime
			// 
			this.lblFromDateTime.AccessibleDescription = resources.GetString("lblFromDateTime.AccessibleDescription");
			this.lblFromDateTime.AccessibleName = resources.GetString("lblFromDateTime.AccessibleName");
			this.lblFromDateTime.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("lblFromDateTime.Anchor")));
			this.lblFromDateTime.AutoSize = ((bool)(resources.GetObject("lblFromDateTime.AutoSize")));
			this.lblFromDateTime.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("lblFromDateTime.Dock")));
			this.lblFromDateTime.Enabled = ((bool)(resources.GetObject("lblFromDateTime.Enabled")));
			this.lblFromDateTime.Font = ((System.Drawing.Font)(resources.GetObject("lblFromDateTime.Font")));
			this.lblFromDateTime.ForeColor = System.Drawing.Color.Maroon;
			this.lblFromDateTime.Image = ((System.Drawing.Image)(resources.GetObject("lblFromDateTime.Image")));
			this.lblFromDateTime.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromDateTime.ImageAlign")));
			this.lblFromDateTime.ImageIndex = ((int)(resources.GetObject("lblFromDateTime.ImageIndex")));
			this.lblFromDateTime.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("lblFromDateTime.ImeMode")));
			this.lblFromDateTime.Location = ((System.Drawing.Point)(resources.GetObject("lblFromDateTime.Location")));
			this.lblFromDateTime.Name = "lblFromDateTime";
			this.lblFromDateTime.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("lblFromDateTime.RightToLeft")));
			this.lblFromDateTime.Size = ((System.Drawing.Size)(resources.GetObject("lblFromDateTime.Size")));
			this.lblFromDateTime.TabIndex = ((int)(resources.GetObject("lblFromDateTime.TabIndex")));
			this.lblFromDateTime.Text = resources.GetString("lblFromDateTime.Text");
			this.lblFromDateTime.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("lblFromDateTime.TextAlign")));
			this.lblFromDateTime.Visible = ((bool)(resources.GetObject("lblFromDateTime.Visible")));
			// 
			// radPeriod
			// 
			this.radPeriod.AccessibleDescription = resources.GetString("radPeriod.AccessibleDescription");
			this.radPeriod.AccessibleName = resources.GetString("radPeriod.AccessibleName");
			this.radPeriod.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("radPeriod.Anchor")));
			this.radPeriod.Appearance = ((System.Windows.Forms.Appearance)(resources.GetObject("radPeriod.Appearance")));
			this.radPeriod.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("radPeriod.BackgroundImage")));
			this.radPeriod.CheckAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radPeriod.CheckAlign")));
			this.radPeriod.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("radPeriod.Dock")));
			this.radPeriod.Enabled = ((bool)(resources.GetObject("radPeriod.Enabled")));
			this.radPeriod.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("radPeriod.FlatStyle")));
			this.radPeriod.Font = ((System.Drawing.Font)(resources.GetObject("radPeriod.Font")));
			this.radPeriod.Image = ((System.Drawing.Image)(resources.GetObject("radPeriod.Image")));
			this.radPeriod.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radPeriod.ImageAlign")));
			this.radPeriod.ImageIndex = ((int)(resources.GetObject("radPeriod.ImageIndex")));
			this.radPeriod.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("radPeriod.ImeMode")));
			this.radPeriod.Location = ((System.Drawing.Point)(resources.GetObject("radPeriod.Location")));
			this.radPeriod.Name = "radPeriod";
			this.radPeriod.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("radPeriod.RightToLeft")));
			this.radPeriod.Size = ((System.Drawing.Size)(resources.GetObject("radPeriod.Size")));
			this.radPeriod.TabIndex = ((int)(resources.GetObject("radPeriod.TabIndex")));
			this.radPeriod.Text = resources.GetString("radPeriod.Text");
			this.radPeriod.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radPeriod.TextAlign")));
			this.radPeriod.Visible = ((bool)(resources.GetObject("radPeriod.Visible")));
			this.radPeriod.CheckedChanged += new System.EventHandler(this.radPeriod_CheckedChanged);
			// 
			// radAll
			// 
			this.radAll.AccessibleDescription = resources.GetString("radAll.AccessibleDescription");
			this.radAll.AccessibleName = resources.GetString("radAll.AccessibleName");
			this.radAll.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("radAll.Anchor")));
			this.radAll.Appearance = ((System.Windows.Forms.Appearance)(resources.GetObject("radAll.Appearance")));
			this.radAll.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("radAll.BackgroundImage")));
			this.radAll.CheckAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radAll.CheckAlign")));
			this.radAll.Checked = true;
			this.radAll.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("radAll.Dock")));
			this.radAll.Enabled = ((bool)(resources.GetObject("radAll.Enabled")));
			this.radAll.FlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("radAll.FlatStyle")));
			this.radAll.Font = ((System.Drawing.Font)(resources.GetObject("radAll.Font")));
			this.radAll.Image = ((System.Drawing.Image)(resources.GetObject("radAll.Image")));
			this.radAll.ImageAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radAll.ImageAlign")));
			this.radAll.ImageIndex = ((int)(resources.GetObject("radAll.ImageIndex")));
			this.radAll.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("radAll.ImeMode")));
			this.radAll.Location = ((System.Drawing.Point)(resources.GetObject("radAll.Location")));
			this.radAll.Name = "radAll";
			this.radAll.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("radAll.RightToLeft")));
			this.radAll.Size = ((System.Drawing.Size)(resources.GetObject("radAll.Size")));
			this.radAll.TabIndex = ((int)(resources.GetObject("radAll.TabIndex")));
			this.radAll.TabStop = true;
			this.radAll.Text = resources.GetString("radAll.Text");
			this.radAll.TextAlign = ((System.Drawing.ContentAlignment)(resources.GetObject("radAll.TextAlign")));
			this.radAll.Visible = ((bool)(resources.GetObject("radAll.Visible")));
			this.radAll.CheckedChanged += new System.EventHandler(this.radAll_CheckedChanged);
			// 
			// rptDeliverySlip
			// 
			this.rptDeliverySlip.ReportName = "Deliver Slip";
			// 
			// rptPrintable
			// 
			this.rptPrintable.ReportName = "Delivery Slip";
			// 
			// rptPrintableReceive
			// 
			this.rptPrintableReceive.ReportName = "Receive Slip";
			// 
			// PODeliverySlip
			// 
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription");
			this.AccessibleName = resources.GetString("$this.AccessibleName");
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize")));
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll")));
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin")));
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize")));
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.CancelButton = this.btnClose;
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize")));
			this.Controls.Add(this.pnlControls);
			this.Controls.Add(this.ppvSlip);
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled")));
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font")));
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode")));
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location")));
			this.MaximizeBox = false;
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize")));
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize")));
			this.Name = "PODeliverySlip";
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft")));
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition")));
			this.Text = resources.GetString("$this.Text");
			this.Load += new System.EventHandler(this.PODeliverySlipReport_Load);
			((System.ComponentModel.ISupportInitialize)(this.ppvSlip)).EndInit();
			this.pnlControls.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dtmToDateTime)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dtmFromDateTime)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.rptDeliverySlip)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.rptPrintable)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.rptPrintableReceive)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void PODeliverySlipReport_Load(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".PODeliverySlipReport_Load()";
			try
			{
				#region Security

				//Set authorization for user
				Security objSecurity = new Security();
				this.Name = THIS;
				if(objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0)
				{
					this.Close();
					// You don't have the right to view this item
					PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning);
					return;
				}

				#endregion

				strReportFilePath = Application.StartupPath + "\\" +Constants.REPORT_DEFINITION_STORE_LOCATION + "\\" + mstrViewFileName;
				strPrintFilePath = Application.StartupPath + "\\" +Constants.REPORT_DEFINITION_STORE_LOCATION + "\\" + mstrReportFileName;
				// format date time
				dtmFromDateTime.FormatType = FormatTypeEnum.CustomFormat;
				dtmFromDateTime.CustomFormat = Constants.DATETIME_FORMAT_HOUR;
				dtmToDateTime.FormatType = FormatTypeEnum.CustomFormat;
				dtmToDateTime.CustomFormat = Constants.DATETIME_FORMAT_HOUR;
				ppvSlip.NavigationPanelVisible = false;
				ppvSlip.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;

				EnableButtons();
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void radAll_CheckedChanged(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".radAll_CheckedChanged()";
			try
			{
				EnableButtons();
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void radPeriod_CheckedChanged(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".radPeriod_CheckedChanged()";
			try
			{
				EnableButtons();
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnView_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnView_Click()";
			try
			{
				Cursor = Cursors.WaitCursor;
				DateTime dtmToDate = DateTime.MaxValue;
				DateTime dtmFromDate = DateTime.MinValue;
				if (radPeriod.Checked)
				{
					if (dtmFromDateTime.Value == DBNull.Value)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dtmFromDateTime.Focus();
						dtmFromDateTime.SelectAll();
						return;
					}
					if (dtmToDateTime.Value == DBNull.Value)
					{
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Error);
						dtmToDateTime.Focus();
						dtmToDateTime.SelectAll();
						return;
					}
					// to date must greater than from date
					dtmToDate = (DateTime)dtmToDateTime.Value;
					dtmFromDate = (DateTime)dtmFromDateTime.Value;
				}
				if (dtmFromDate > dtmToDate)
				{
					PCSMessageBox.Show(ErrorCode.MESSAGE_MP_PERIODDATE, MessageBoxIcon.Error);
					dtmFromDateTime.Focus();
					return;
				}
				// check if report file is exist or not
				if (!File.Exists(strReportFilePath))
				{
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
					return;
				}
				// check if report file is exist or not
				if (!File.Exists(strPrintFilePath))
				{
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
					return;
				}
				// only care about date and hour, 
				// ignore minutes and the other information
				if (dtmToDate != DateTime.MaxValue)
					dtmToDate = new DateTime(dtmToDate.Year, dtmToDate.Month, dtmToDate.Day, dtmToDate.Hour, 59, 59);
				if (dtmFromDate != DateTime.MinValue)
					dtmFromDate = new DateTime(dtmFromDate.Year, dtmFromDate.Month, dtmFromDate.Day, dtmFromDate.Hour, 0, 0);
				// get the issue date
				DateTime dtmIssueDate = new UtilsBO().GetDBDate();
				PODeliverySlipBO boDeliverySlip = new PODeliverySlipBO();
				// execute report
				DataTable dtbData = boDeliverySlip.ExecuteReport(voPOMaster.PurchaseOrderMasterID, dtmFromDate, dtmToDate);
				// refine data source
				//bool blnIsOver = BuildReportData(ref dtbData);
				DataSet dstData = BuildReportData(dtbData);
				//RenderReport(dtmIssueDate, dtbData, !blnIsOver);
				RenderReport(dtmIssueDate, dstData);
				
				// hide all control
				//pnlControls.Visible = false;
				// visible print preview
				//ppvSlip.Visible = true;
				//this.MaximizeBox = true;
				//this.WindowState = FormWindowState.Maximized;
				//this.FormBorderStyle = FormBorderStyle.Sizable;
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			finally
			{
				Cursor = Cursors.Default;
			}
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnHelp_Click(object sender, System.EventArgs e)
		{
		
		}

		private void ppvSlip_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			const string METHOD_NAME = THIS + ".ppvSlip_ButtonClick()";
		}

		/// <summary>
		/// Rendering the report with all parameter
		/// </summary>
		/// <param name="pdtmIssueDate">The Issue Date</param>
		/// <param name="pdtbReportData">Report Data</param>
		private void RenderReport(DateTime pdtmIssueDate, DataTable pdtbReportData, bool pblnPrintTwoSlipInOnePage)
		{
			// prevent reentrant calls
			if (rptDeliverySlip.IsBusy)
				return;
			// initialize control
			rptDeliverySlip.Clear(); // clear any existing fields
			rptPrintable.Clear();
			string[] strReportInfo = rptDeliverySlip.GetReportInfo(strPrintFilePath);
			string[] strPrintInfo = rptPrintable.GetReportInfo(strPrintFilePath);
			if (strReportInfo != null && strReportInfo.Length > 0)
				rptDeliverySlip.Load(strReportFilePath, strReportInfo[0]);
			if (strPrintInfo != null && strPrintInfo.Length > 0)
				rptPrintable.Load(strPrintFilePath, strPrintInfo[0]);

			int intNumOfRows = pdtbReportData.Rows.Count;
			// set datasource object that provides data to report.
			rptDeliverySlip.DataSource.Recordset = pdtbReportData;
			rptPrintable.DataSource.Recordset = pdtbReportData;
			C1Report rptSubReport = rptDeliverySlip.Fields[SUB_REPORT_FLD].Subreport;
			C1Report rptPrintSubReport = rptPrintable.Fields[SUB_REPORT_FLD].Subreport;
			if (intNumOfRows > 0 && !pblnPrintTwoSlipInOnePage)
			{
				rptDeliverySlip.Fields[SUB_REPORT_FLD].Text = string.Empty;
				rptPrintable.Fields[SUB_REPORT_FLD].Text = string.Empty;
				rptDeliverySlip.Groups[SCHEDULE_HOUR_FLD].SectionFooter.Visible = false;
				rptPrintable.Groups[SCHEDULE_HOUR_FLD].SectionFooter.Visible = false;

				#region PUSH PARAMETER VALUE

				// header information get from system params
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
				}
				catch{}

				#endregion

				// render the report into the PrintPreviewControl
				//ppvSlip.Document = rptDeliverySlip.Document;
				PreviewOnlyNoPrintDialog dlgDeliveryPreview = new PreviewOnlyNoPrintDialog();
				dlgDeliveryPreview.ReportViewer.Document = rptDeliverySlip.Document;
				dlgDeliveryPreview.ReportViewer.NavigationPanelVisible = false;
				dlgDeliveryPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
				//dlgDeliveryPreview.ReportViewer.Name = RECEIVE_SLIP;
				try
				{
					dlgDeliveryPreview.FormTitle = rptDeliverySlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgDeliveryPreview.Show();

				// make a copy of delivery slip to receive slip and show in different printpreview
				C1Report rptReceiveSlip = new C1Report();
				rptReceiveSlip.CopyFrom(rptDeliverySlip);
				rptPrintableReceive.CopyFrom(rptPrintable);
				try
				{
					rptReceiveSlip.Fields[TITLE_FLD].Text = rptSubReport.Fields[TITLE_FLD].Text;
					rptPrintableReceive.Fields[TITLE_FLD].Text = rptPrintSubReport.Fields[TITLE_FLD].Text;
				}
				catch{}
				try
				{
					rptReceiveSlip.Fields["fldCopied"].Text = rptSubReport.Fields["fldCopied"].Text;
					rptPrintableReceive.Fields["fldCopied"].Text = rptPrintSubReport.Fields["fldCopied"].Text;
				}
				catch{}
				try
				{
					rptReceiveSlip.Fields["fldTitleVN"].Text = rptSubReport.Fields["fldTitleVN"].Text;
					rptPrintableReceive.Fields["fldTitleVN"].Text = rptPrintSubReport.Fields["fldTitleVN"].Text;
				}
				catch{}
				PreviewOnlyNoPrintDialog dlgReceivePreview = new PreviewOnlyNoPrintDialog();
				dlgReceivePreview.ReportViewer.Document = rptReceiveSlip.Document;
				dlgReceivePreview.ReportViewer.NavigationPanelVisible = false;
				dlgReceivePreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
				dlgReceivePreview.ReportViewer.Name = RECEIVE_SLIP;
				
				try
				{
					dlgReceivePreview.FormTitle = rptReceiveSlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgReceivePreview.Show();
			}
			else if (intNumOfRows > 0 && pblnPrintTwoSlipInOnePage)
			{
				rptSubReport.DataSource.Recordset = pdtbReportData;
				rptPrintSubReport.DataSource.Recordset = pdtbReportData;

				#region PUSH PARAMETER VALUE

				// header information get from system params
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
				}
				catch{}

				#endregion

				// render the report into the PrintPreviewControl
				//ppvSlip.Document = rptDeliverySlip.Document;
				PreviewOnlyNoPrintDialog dlgPreview = new PreviewOnlyNoPrintDialog();
				dlgPreview.ReportViewer.Document = rptDeliverySlip.Document;
				dlgPreview.ReportViewer.NavigationPanelVisible = false;
				dlgPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
				
				try
				{
					dlgPreview.FormTitle = rptDeliverySlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgPreview.Show();
			}
			else
			{
				// enable report header section
				rptDeliverySlip.Sections[SectionTypeEnum.Header].Visible = true;
				rptPrintable.Sections[SectionTypeEnum.Header].Visible = true;
				// enable page header section
				//rptDeliverySlip.Sections[SectionTypeEnum.PageHeader].Visible = true;

				#region PUSH PARAMETER VALUE

				// header information get from system params
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[SLIP_NO_FLD].Text = voPOMaster.Code + SEPERATOR + pdtmIssueDate.ToString(DATE_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[SLIP_NO_FLD].Text = voPOMaster.Code + SEPERATOR + pdtmIssueDate.ToString(DATE_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[PONO_FLD].Text = voPOMaster.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
				}
				catch{}
				UtilsBO boUtils = new UtilsBO();
				MST_Party voParty = new PartyBO().GetParty(voPOMaster.PartyID,string.Empty);
				MST_CCNVO voCCN = (MST_CCNVO)boUtils.GetCCNInfo(voPOMaster.CCNID);
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CUST_CODE_FLD].Text = voParty.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CUST_CODE_FLD].Text = voParty.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CUST_NAME_FLD].Text = voParty.Name;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CUST_NAME_FLD].Text = voParty.Name;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CCN_CODE_FLD].Text = voCCN.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CCN_CODE_FLD].Text = voCCN.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CCN_NAME_FLD].Text = voCCN.Name;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CCN_NAME_FLD].Text = voCCN.Name;
				}
				catch{}

				#endregion

				// render the report into the PrintPreviewControl
				//ppvSlip.Document = rptDeliverySlip.Document;
				PreviewOnlyNoPrintDialog dlgPreview = new PreviewOnlyNoPrintDialog();
				dlgPreview.ReportViewer.Document = rptDeliverySlip.Document;
				dlgPreview.ReportViewer.NavigationPanelVisible = false;
				dlgPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
				try
				{
					dlgPreview.FormTitle = rptDeliverySlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgPreview.Show();
			}
		}
		/// <summary>
		/// Rendering the report with all parameter
		/// </summary>
		/// <param name="pdtmIssueDate">The Issue Date</param>
		/// <param name="pdtbReportData">Report Data</param>
		private void RenderReport(DateTime pdtmIssueDate, DataSet pdstReportData)
		{
			// prevent reentrant calls
			if (rptDeliverySlip.IsBusy)
				return;
			// initialize control
			rptDeliverySlip.Clear(); // clear any existing fields
			rptPrintable.Clear();
			rptOverDeliverySlip = new C1Report();
			rptOverPrintable = new C1Report();
			rptOverDeliverySlip.CopyFrom(rptDeliverySlip);
			rptOverPrintable.CopyFrom(rptPrintable);
			rptOverDeliverySlip.Clear(); // clear any existing fields
			rptOverPrintable.Clear();
			string[] strReportInfo = rptDeliverySlip.GetReportInfo(strPrintFilePath);
			string[] strPrintInfo = rptPrintable.GetReportInfo(strPrintFilePath);
			if (strReportInfo != null && strReportInfo.Length > 0)
			{
				rptDeliverySlip.Load(strReportFilePath, strReportInfo[0]);
				rptOverDeliverySlip.Load(strReportFilePath, strReportInfo[0]);
			}
			if (strPrintInfo != null && strPrintInfo.Length > 0)
			{
				rptPrintable.Load(strPrintFilePath, strPrintInfo[0]);
				rptOverPrintable.Load(strPrintFilePath, strPrintInfo[0]);
			}

			DataTable dtbOriginalData = pdstReportData.Tables[TABLE_NAME];
			DataTable dtbSecondData = new DataTable();
			if (pdstReportData.Tables.Count > 1)
				dtbSecondData = pdstReportData.Tables[TABLE_NAME + MAX_LINE_PER_SLIP.ToString()];

			//int intNumOfRows = dtbOriginalData.Rows.Count;
			// set datasource object that provides data to report.
			rptDeliverySlip.DataSource.Recordset = dtbOriginalData;
			rptPrintable.DataSource.Recordset = dtbOriginalData;
			C1Report rptSubReport = rptDeliverySlip.Fields[SUB_REPORT_FLD].Subreport;
			C1Report rptPrintSubReport = rptPrintable.Fields[SUB_REPORT_FLD].Subreport;

			if (dtbOriginalData.Rows.Count > 0)
			{
				rptSubReport.DataSource.Recordset = dtbOriginalData;
				rptPrintSubReport.DataSource.Recordset = dtbOriginalData;

				#region PUSH PARAMETER VALUE

				// header information get from system params
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintSubReport.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
				}
				catch{}

				#endregion

				// render the report into the PrintPreviewControl
				PreviewOnlyNoPrintDialog dlgPreview = new PreviewOnlyNoPrintDialog();
				dlgPreview.ReportViewer.Document = rptDeliverySlip.Document;
				dlgPreview.ReportViewer.NavigationPanelVisible = false;
				dlgPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.ActualSize;
				try
				{
					dlgPreview.FormTitle = rptDeliverySlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgPreview.Show();
			}

			// print delivery slip and receive slip seperated
			if (pdstReportData.Tables.Count > 1)
			{
				#region Displays the over data
				if (dtbSecondData != null && dtbSecondData.Rows.Count > 0)
				{
					rptOverDeliverySlip.DataSource.Recordset = dtbSecondData;
					rptOverPrintable.DataSource.Recordset = dtbSecondData;
					rptOverDeliverySlip.Fields[SUB_REPORT_FLD].Text = string.Empty;
					rptOverPrintable.Fields[SUB_REPORT_FLD].Text = string.Empty;
					rptOverDeliverySlip.Groups[SCHEDULE_HOUR_FLD].SectionFooter.Visible = false;
					rptOverPrintable.Groups[SCHEDULE_HOUR_FLD].SectionFooter.Visible = false;

					#region Delivery Slip first

					#region PUSH PARAMETER VALUE

					// header information get from system params
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[PONO_FLD].Text = voPOMaster.Code;
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					}
					catch{}
					try
					{
						rptOverDeliverySlip.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
						rptOverPrintable.Sections[SectionTypeEnum.GroupHeader2].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					}
					catch{}

					#endregion

					// render the report into the PrintPreviewControl
					PreviewOnlyNoPrintDialog dlgDeliveryPreview = new PreviewOnlyNoPrintDialog();
					dlgDeliveryPreview.ReportViewer.Document = rptOverDeliverySlip.Document;
					dlgDeliveryPreview.ReportViewer.NavigationPanelVisible = false;
					dlgDeliveryPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
					try
					{
						dlgDeliveryPreview.FormTitle = rptOverDeliverySlip.Fields[TITLE_FLD].Text;
					}
					catch{}
					dlgDeliveryPreview.Show();

					#endregion

					#region Receive Slip

					// make a copy of delivery slip to receive slip and show in different printpreview
					C1Report rptReceiveSlip = new C1Report();
					rptReceiveSlip.CopyFrom(rptOverDeliverySlip);
					rptPrintableReceive.CopyFrom(rptOverPrintable);
					try
					{
						rptReceiveSlip.Fields[TITLE_FLD].Text = rptSubReport.Fields[TITLE_FLD].Text;
						rptPrintableReceive.Fields[TITLE_FLD].Text = rptPrintSubReport.Fields[TITLE_FLD].Text;
					}
					catch{}
					try
					{
						rptReceiveSlip.Fields[COPIED_FLD].Text = rptSubReport.Fields[COPIED_FLD].Text;
						rptPrintableReceive.Fields[COPIED_FLD].Text = rptPrintSubReport.Fields[COPIED_FLD].Text;
					}
					catch{}
					try
					{
						rptReceiveSlip.Fields[TITLE_VN_FLD].Text = rptSubReport.Fields[TITLE_VN_FLD].Text;
						rptPrintableReceive.Fields[TITLE_VN_FLD].Text = rptPrintSubReport.Fields[TITLE_VN_FLD].Text;
					}
					catch{}
					PreviewOnlyNoPrintDialog dlgReceivePreview = new PreviewOnlyNoPrintDialog();
					dlgReceivePreview.ReportViewer.Document = rptReceiveSlip.Document;
					dlgReceivePreview.ReportViewer.NavigationPanelVisible = false;
					dlgReceivePreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
					dlgReceivePreview.ReportViewer.Name = RECEIVE_SLIP;
					try
					{
						dlgReceivePreview.FormTitle = rptReceiveSlip.Fields[TITLE_FLD].Text;
					}
					catch{}
					dlgReceivePreview.Show();

					#endregion
				}
				#endregion
			}
			else if (dtbOriginalData.Rows.Count == 0)
			{
				// enable report header section
				rptDeliverySlip.Sections[SectionTypeEnum.Header].Visible = true;
				rptPrintable.Sections[SectionTypeEnum.Header].Visible = true;
				// enable page header section
				//rptDeliverySlip.Sections[SectionTypeEnum.PageHeader].Visible = true;

				#region PUSH PARAMETER VALUE

				// header information get from system params
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[COMPANY_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ADDRESS_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.ADDRESS);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[TEL_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.TEL);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[FAX_FLD].Text = SystemProperty.SytemParams.Get(SystemParam.FAX);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[SLIP_NO_FLD].Text = voPOMaster.Code + SEPERATOR + pdtmIssueDate.ToString(DATE_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[SLIP_NO_FLD].Text = voPOMaster.Code + SEPERATOR + pdtmIssueDate.ToString(DATE_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[PONO_FLD].Text = voPOMaster.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[PONO_FLD].Text = voPOMaster.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ISSUE_DATE_FLD].Text = pdtmIssueDate.ToString(Constants.DATETIME_FORMAT);
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[ISSUEHOUR_FLD].Text = pdtmIssueDate.ToString(SHORT_TIME_FORMAT);
				}
				catch{}
				UtilsBO boUtils = new UtilsBO();
				MST_Party voParty = new PartyBO().GetParty(voPOMaster.PartyID,string.Empty);
				MST_CCNVO voCCN = (MST_CCNVO)boUtils.GetCCNInfo(voPOMaster.CCNID);
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CUST_CODE_FLD].Text = voParty.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CUST_CODE_FLD].Text = voParty.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CUST_NAME_FLD].Text = voParty.Name;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CUST_NAME_FLD].Text = voParty.Name;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CCN_CODE_FLD].Text = voCCN.Code;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CCN_CODE_FLD].Text = voCCN.Code;
				}
				catch{}
				try
				{
					rptDeliverySlip.Sections[SectionTypeEnum.Header].Fields[CCN_NAME_FLD].Text = voCCN.Name;
					rptPrintable.Sections[SectionTypeEnum.Header].Fields[CCN_NAME_FLD].Text = voCCN.Name;
				}
				catch{}

				#endregion

				// render the report into the PrintPreviewControl
				//ppvSlip.Document = rptDeliverySlip.Document;
				PreviewOnlyNoPrintDialog dlgPreview = new PreviewOnlyNoPrintDialog();
				dlgPreview.ReportViewer.Document = rptDeliverySlip.Document;
				dlgPreview.ReportViewer.NavigationPanelVisible = false;
				dlgPreview.ReportViewer.PreviewPane.ZoomMode = ZoomModeEnum.PageWidth;
				try
				{
					dlgPreview.FormTitle = rptDeliverySlip.Fields[TITLE_FLD].Text;
				}
				catch{}
				dlgPreview.Show();
			}
		}
		/// <summary>
		/// Enable button based on the option All or Period
		/// </summary>
		private void EnableButtons()
		{
			lblFromDateTime.Enabled = radPeriod.Checked;
			dtmFromDateTime.Enabled = radPeriod.Checked;
			lblToDateTime.Enabled = radPeriod.Checked;
			dtmToDateTime.Enabled = radPeriod.Checked;
		}

		/// <summary>
		/// Build report data match with the report template from source data
		/// </summary>
		/// <param name="pdtbData">Source Data</param>
		/// <returns>True if more than 10 rows</returns>
		private bool BuildReportData(ref DataTable pdtbData)
		{
			bool blnIsOver = false;
			DataTable dtbResult = pdtbData.Clone();
			foreach (DataColumn dcolData in dtbResult.Columns)
				dcolData.AllowDBNull = true;
			ArrayList arrDates = new ArrayList();
			// get all schedule date
			foreach (DataRow drowData in pdtbData.Rows)
			{
				DateTime dtmRowDate = (DateTime)drowData[PO_DeliveryScheduleTable.SCHEDULEDATE_FLD];
				int intRowHour = (int)drowData[SCHEDULE_HOUR_FLD];
				dtmRowDate = dtmRowDate.AddHours(intRowHour);
				if (!arrDates.Contains(dtmRowDate))
					arrDates.Add(dtmRowDate);
			}
			arrDates.Sort();
			arrDates.TrimToSize();
			// foreach schedule date
			foreach (DateTime dtmScheduleDate in arrDates)
			{
				DateTime dtmDate = new DateTime(dtmScheduleDate.Year, dtmScheduleDate.Month, dtmScheduleDate.Day);
				// select all delivery line of today in source table
				string strExpr = PO_DeliveryScheduleTable.SCHEDULEDATE_FLD + Constants.EQUAL + "'" + dtmDate.ToString() + "'"
					+ Constants.AND + SCHEDULE_HOUR_FLD + Constants.EQUAL + "'" + dtmScheduleDate.Hour + "'";
				DataRow[] drowLines = pdtbData.Select(strExpr);
				int intMissing = MAX_LINE_PER_SLIP - drowLines.Length;
				if (drowLines.Length > MAX_LINE_PER_SLIP)
					blnIsOver = true;
				//if (intMissing < 0)
				//	continue;
				for (int i = 0; i < drowLines.Length; i++)
				{
					dtbResult.ImportRow(drowLines[i]);
				}
				for (int i = 1; i <= intMissing; i++)
				{
					DataRow drowNew = dtbResult.NewRow();
					drowNew[PO_DeliveryScheduleTable.SCHEDULEDATE_FLD] = dtmDate;
					drowNew[SCHEDULE_HOUR_FLD] = dtmScheduleDate.Hour;
					dtbResult.Rows.Add(drowNew);
				}
			}
			pdtbData.Clear();
			pdtbData = dtbResult.Copy();
			return blnIsOver;
		}
		/// <summary>
		/// Build report data match with the report template from source data
		/// </summary>
		/// <param name="pdtbData">Source Data</param>
		/// <returns>DataSet will have more than one DataTable inside if any time have more than 10 rows</returns>
		private DataSet BuildReportData(DataTable pdtbData)
		{
			DataSet dstData = new DataSet();
			DataTable dtbResult = pdtbData.Clone();
			DataTable dtbOver = pdtbData.Clone();
			dtbOver.TableName += MAX_LINE_PER_SLIP.ToString();
			foreach (DataColumn dcolData in dtbResult.Columns)
				dcolData.AllowDBNull = true;
			ArrayList arrDates = new ArrayList();
			// get all schedule date
			foreach (DataRow drowData in pdtbData.Rows)
			{
				DateTime dtmRowDate = (DateTime)drowData[PO_DeliveryScheduleTable.SCHEDULEDATE_FLD];
				int intRowHour = (int)drowData[SCHEDULE_HOUR_FLD];
				dtmRowDate = dtmRowDate.AddHours(intRowHour);
				if (!arrDates.Contains(dtmRowDate))
					arrDates.Add(dtmRowDate);
			}
			arrDates.Sort();
			arrDates.TrimToSize();
			// foreach schedule date
			foreach (DateTime dtmScheduleDate in arrDates)
			{
				DateTime dtmDate = new DateTime(dtmScheduleDate.Year, dtmScheduleDate.Month, dtmScheduleDate.Day);
				// select all delivery line of today in source table
				string strExpr = PO_DeliveryScheduleTable.SCHEDULEDATE_FLD + Constants.EQUAL + "'" + dtmDate.ToString() + "'"
					+ Constants.AND + SCHEDULE_HOUR_FLD + Constants.EQUAL + "'" + dtmScheduleDate.Hour + "'";
				DataRow[] drowLines = pdtbData.Select(strExpr);
				int intMissing = MAX_LINE_PER_SLIP - drowLines.Length;
				if (drowLines.Length > MAX_LINE_PER_SLIP)
				{
					for (int i = 0; i < drowLines.Length; i++)
						dtbOver.ImportRow(drowLines[i]);
				}
				else
				{
					for (int i = 0; i < drowLines.Length; i++)
						dtbResult.ImportRow(drowLines[i]);
					for (int i = 1; i <= intMissing; i++)
					{
						DataRow drowNew = dtbResult.NewRow();
						drowNew[PO_DeliveryScheduleTable.SCHEDULEDATE_FLD] = dtmDate;
						drowNew[SCHEDULE_HOUR_FLD] = dtmScheduleDate.Hour;
						dtbResult.Rows.Add(drowNew);
					}
				}
			}
			dstData.Tables.Add(dtbResult);
			if (dtbOver.Rows.Count > 0)
				dstData.Tables.Add(dtbOver);
			return dstData;
		}
	}
}